﻿using ChineseSchool.Models.Hethong;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace ChineseSchool.BLL
{
    public class B_UserComment
    {
        private PetaPoco.Database db;
        private B_Insert_Update_Delete crud = new B_Insert_Update_Delete();

        public B_UserComment()
        {
            db = new PetaPoco.Database("ConnectionString");
        }

        public List<M_UserComment> GetAllsByUserId(int userId)
        {
            var lstComment = db.Fetch<M_UserComment>(@";EXEC UserComment_GetByUserId @@UserId = @0", userId);
            return lstComment;
        }

        public void PostComment(M_UserComment comment)
        {
            crud.insert("UserComment", "PostId", comment);
        }
    }
}